<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>车源管理列表</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="__STATIC__/admin/static/css/font.css">
		<link rel="stylesheet" href="__STATIC__/admin/static/css/weadmin.css">
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
	      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
	    <script type="text/javascript" src='__STATIC__/admin/static/js/jquery3.2.1.min.js'></script>
	</head>

	<body>
		<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">车源管理</a>
        <a>
          <cite>车源管理列表</cite></a>
      </span>
			<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
				<i class="layui-icon" style="line-height:30px">ဂ</i></a>
		</div>
		<div class="weadmin-body">
			<div class="layui-row">
				<form class="layui-form layui-col-md12 we-search">
					<div class="layui-inline">
						<input type="text" name="bname" placeholder="请输入品牌名" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-inline">
						<input type="text" name="oname" placeholder="请输入发布人名" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-inline">
						<input type="text" name="pname" placeholder="请输入省级名" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-inline">
						<input type="text" name="aname" placeholder="请输入城市名" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-inline">
						<input type="text" name="preprice" placeholder="请输入最高价(万)" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
				</form>
			</div>
			<div class="weadmin-block">
				<button class="layui-btn layui-btn-danger" onclick="delAll('{:url(\'admin/carsource/carsourcedel\')}')"><i class="layui-icon"></i>批量删除</button>
				<button class="layui-btn" onclick="WeAdminShow('添加车级','{:url(\'admin/carsource/carsourceadd\')}')"><i class="layui-icon"></i>添加</button>
			</div>
			<table class="layui-table">
				<thead>
					<tr>
						<th>
							<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
						</th>
						<th>ID</th>
						<th>名称</th>
						<th>级别</th>
						<th>报价</th>
						<th>城市</th>
						<th>发布人</th>
						<th>发布日期</th>
						<th>点击量</th>
						<th>是否推荐</th>
						<th>是否热门</th>
						<th>是否已卖</th>
						<th>是否展示</th>
						<th>操作</th>
				</thead>
				<tbody>
					
					{foreach $info as $v}
					
					<tr>
						<td>
							<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id="{$v['sid']}"><i class="layui-icon">&#xe605;</i></div>
						</td>
						<td>{$v['sid']}</td>
						<td>
							<div class='deti' style="white-space:nowrap;text-overflow:ellipsis;overflow:hidden; width:100px">{$v['gname']}  {$v['cname']}  {$v['tname']}</div>
						</td>
						<td>{$v['lname']}</td>
						<td>{$v['preprice']}万</td>
						<td>{$v['pname']}--{$v['aname']}</td>
						<td>{$v['oname']}</td>
						<td>{$v['pubtime']|date='Y-m-d'}</td>
						<td>{$v['click']}</td>
						<td>
							<form class="layui-form com" action="">
								<div class="layui-input-inline">
									<input type="checkbox" name="iscom" lay-skin="switch" lay-text="推荐|不推荐" {if $v['is_commend']==1}checked{/if} value="{$v['sid']}">
								</div>
							</form>
						</td>
						<td>
							<form class="layui-form com" action="">
								<div class="layui-input-inline">
									<input type="checkbox" name="ishot" lay-skin="switch" lay-text="热门|非热门" {if $v['is_hot']==1}checked{/if} value="{$v['sid']}">
								</div>
							</form>
						</td>
						<td>
							<form class="layui-form com" action="">
								<div class="layui-input-inline">
									<input type="checkbox" name="issell" lay-skin="switch" lay-text="已卖|未卖" {if $v['is_sell']==1}checked{/if} value="{$v['sid']}">
								</div>
							</form>
						</td>
						<td class="td-status">
							{eq name="$v['is_show']" value="1"}
							<span class="layui-btn layui-btn-normal layui-btn-xs">已启用</span>
							{else/}
							<span class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled">已停用</span>
							{/eq}
						</td>
						<td class="td-manage">
							{eq name="$v['is_show']" value="1"}
							<a onclick="member_stop(this,'{:url(\'admin/carsource/carsource\')}',{$v['is_show']},{$v['sid']})" href="javascript:;" title="启用">
								<i class="layui-icon">&#xe601;</i>
							</a>
							{else/}
							<a onclick="member_stop(this,'{:url(\'admin/carsource/carsource\')}',{$v['is_show']},{$v['sid']})" href="javascript:;" title="停用">
								<i class="layui-icon">&#xe62f;</i>
							</a>
							{/eq}
							<a title="编辑" onclick="WeAdminShow('编辑','{:url(\'admin/carsource/carsourceedit\',[\'sid\'=>$v[\'sid\']])}')" href="javascript:;">
								<i class="layui-icon">&#xe642;</i>
							</a>
							<a title="删除" onclick="member_del({$v['sid']},'{:url(\'admin/carsource/carsourcedel\')}')" href="javascript:;">
								<i class="layui-icon">&#xe640;</i>
							</a>
						</td>
					</tr>
					
					{/foreach}
				</tbody>
			</table>
			<div class="page">
				<div>
					{$info|raw}
				</div>
			</div>
		</div>
		<script src="__STATIC__/admin/lib/layui/layui.js" charset="utf-8"></script>
    	<script src="__STATIC__/admin/static/js/eleDel.js" type="text/javascript" charset="utf-8"></script>
    	<script type="text/javascript">
			$('.deti').mouseover(function(){
				con=$(this).html();
				con=con.substr(0,con.length);
				$(this).attr('title',con);
			})
			layui.use('form', function(){
				var form = layui.form;
			  
			  	form.on('switch', function(data){
  					var id = data.value;
  					var name = this.name
					if(data.elem.checked == true){
						var ic = 1;
					}else{
						var ic = 0;
					}
					$.ajax({
						type: 'POST',
						url: "{:url('admin/carsource/carsource')}",
						dataType: 'json',
						data:name+"="+ic+"&id="+id,
						success: function(data){
						}
					});
				});  
			});
		</script>
	</body>

</html>